package pe.edu.pucp.cpnc.mm.bean;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;


@XmlRootElement
public class ObjectDetail implements Serializable {
        private static int idGen=0;
        @XmlAttribute
        @XmlID
        private String id;
	private Object object;
	private int posX;
	private int posY;
	private int orientation; //0=N 1=NE 2=E 3=SE 4=S 5=SO 6=0 7=NO
	
	public ObjectDetail(){
		id=""+idGen;
                idGen++;
	}
        
        public ObjectDetail(ObjectDetail oDet){
            id = oDet.id;
            orientation = oDet.orientation;
            object = oDet.object;
            posX = oDet.posX;
            posY = oDet.posY;
            object = oDet.object;
        }
	
	@XmlElementRef
	public Object getObject() {
		return object;
	}
	public void setObject(Object object) {
		this.object = object;
	}
	public int getPosX() {
		return posX;
	}
	public void setPosX(int posX) {
		this.posX = posX;
	}
	public int getPosY() {
		return posY;
	}
	public void setPosY(int posY) {
		this.posY = posY;
	}
	public int getOrientation() {
		return orientation;
	}
	public void setOrientation(int orientation) {
		this.orientation = orientation;
	}
        
        public boolean isEqualTo(ObjectDetail o2){
            return (id.equals(o2.id));
        }
        
        public String getId(){
            return id;
        }
}
